<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .big1 {
            width: 1000px;
            height: 500px;
            background-color: #800020;
        }

        .sm1 {
            width: 500px;
            height: 400px;
            margin: 0 auto;
            background-color: #f5dc3a;
        }

        .big2 {
            width: 100%;
            height: 500px;
            background-color: #800020;
        }

        .sm2 {
            width: 50%;
            height: 400px;
            margin: 0 auto;
            background-color: #f5dc3a;
        }

        .big3 {
            width: 100%;
            height: 500px;
            background-color: #800020;
        }

        .sm3 {
            width: 40%;
            height: 400px;
            margin-left: 50%;
            background-color: #f5dc3a;
            transform: translateX(-50%);
        }

        .big4 {
            width: 100%;
            height: 500px;
            background-color: #800020;
            display: flex;
        }

        .sm4 {
            height: 400px;
            flex: 8;
            background-color: #f5dc3a;
        }

        .left {
            flex: 1;
            height: 400px;
            background-color: #fff;
        }

        .right {
            flex: 1;
            height: 400px;
            background-color: #fff;
        }
    </style>
</head>
<body>
    <div class="big1">
        <div class="sm1">big1是固定宽度，sm1要在big1中左右居中</div>
    </div>
    <hr>
    <div class="big2">
        <div class="sm2">big2是不固定宽度，sm2要在big2中左右居中</div>
    </div>
    <hr>
    <div class="big3">
        <div class="sm3">big3是不固定宽度，sm3要在big3中左右居中</div>
    </div>
    <hr>
    <div class="big4">
        <div class="left"></div>
        <div class="sm4">big4</div>
        <div class="right"></div>
    </div>
</body>
</html>